import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface PutDetailSaveByName_ {
  /**
   * @description name
   */
  name: string;
}
export interface GetDetailByName_ {
  /**
   * @description name
   */
  name: string;
}

export class MetricsMarket {
  /**
   * 条件配置
   *
   * @tags 指标市场controller
   * @request GET: /market/setting/condition
   * @secure
   */
  getCondition = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsMarketConditionVO>({
      url: `/market/setting/condition`,
      method: "GET",
      ...params,
    });

  /**
   * 条件设置保存
   *
   * @tags 指标市场controller
   * @request PUT: /market/setting/condition/save
   * @secure
   */
  putConditionSave = (conditionVO: defs.MetricsMarketConditionVO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsMarketConditionVO>({
      url: `/market/setting/condition/save`,
      method: "PUT",
      data: conditionVO,
      ...params,
    });

  /**
   * 详情设置保存
   *
   * @tags 指标市场controller
   * @request PUT: /market/setting/detail/save/{name}
   * @secure
   */
  putDetailSaveByName = (
    { name }: { name: string } | PutDetailSaveByName_,
    metricsMarketDetailVO: defs.MetricsMarketDetailVO,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityMetricsMarketDetailVO>({
      url: `/market/setting/detail/save/${name}`,
      method: "PUT",
      data: metricsMarketDetailVO,
      ...params,
    });

  /**
   * 详情页配置
   *
   * @tags 指标市场controller
   * @request GET: /market/setting/detail/{name}
   * @secure
   */
  getDetailByName = ({ name }: { name: string } | GetDetailByName_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsMarketDetailVO>({
      url: `/market/setting/detail/${name}`,
      method: "GET",
      ...params,
    });
}

export default new MetricsMarket();
